exactMatch: BOOLEAN; { If TRUE, Creator MUST match }
creatorAndTypeMask: SignedByte; { Flags telling which bytes of file & creator types matter }
END;
{ The TransDescribe data stucture defines an import/export translator. There is one }
{ of these (corresponds to the 'FTYP' resource) for every import/export translator. }
TransDescrHandle = ^TransDescrPtr;
TransDescrPtr = ^TransDescribe;
TransDescribe = RECORD
version: INTEGER; { Version of this FTYP (currently 2) }
translatorType: ResType; { Type of translator (ie, 'PFLT' for pictures) }
codeResID: INTEGER; { Resource ID of translator code resource }
FDIFResID: INTEGER; { Resource ID of 'FDIF' (or -1 if none) }
numVersBytes: INTEGER; { Number of bytes for version check (zero if no check) }
versBytesOffSet: LONGINT; { Offset into file for version check }
versBytes: PACKED ARRAY[0..15] OF SIgnedByte; { Byte values we are looking for (max 16) }
appWDRefNum: INTEGER; { vRefNum of the volume containing the application folder }
unused1: INTEGER; { }
pathLength: INTEGER; { Number of times this file has been translated }
flags: INTEGER; { Flags for filter characteristics }
{ bit 0 - set if this filter won't work with All Available }
{ bit 1 - set if this filter has a preferences dialog }
{ bit 2 - set if this filter must be able to read its resources }
{ bit 3 - 4 reserved for future use - must be zero for this version }
{ bit 5 - set if this filter is localized to a particular language }
{ bit 6 - 14 reserved for future use - must be zero for this version }
{ bit 15 - Used internally - must be zero for this version }
transIndex: INTEGER; { Internal XTND use only - Index of this translator in the list stored by the FINI }
resRefNum: INTEGER; { RefNum of resource fork of the translator file when open }
directoryID: LONGINT; { Directory ID of the folder containing the filter }
vRefNum: INTEGER; { Volume RefNum of volume which contains filter directory }
fileName: Str31; { Name of file if this is an external filter }
numMatches: INTEGER; { Number of Matches for this translator (0 means all files) }
matches: ARRAY[0..9] OF MatchInfo; { An array of all file matches for this translator }
name: Str31; { Description of translator - appears in pop-up menus }
END;
{ The XTND file parameter block. }
SFParamPtr = ^SFParamBlock;
SFParamBlock = RECORD
{ The following fields must be the same in this structure and MatchTranslatorBlock }
allowFlags: LongInt; { --> Flags which indicate Translators to be used }
numStandard: LongInt; { --> How many "standard" file types }
standard: TransDescrPtr; { --> Native file format information }
ioResult: OSErr; { <-- Errors reported through this variable }
chosenTranslator: Integer; { <-- chosen Translator number }
theChosenTranslator: TransDescrPtr; { <-- Points to the Chosen Translator }
{ End of common fields }
fileReply: ^SFReply; { <-- File information is returned through this pointer }
applicNativeType: ResType; { --> Application native document file type, for use when library cannot be found }
XTNDDlogHook: XTNDDlgHookProcPtr; { --> Pointer to your SF dialog hook }
currentMenuItem: INTEGER; { <-- chosen menu item (GetFile) }
currentSaveItem: INTEGER; { <-- chosen menu item (PutFile) }
where: Point; { --> Top left corner of dialog, if zero, center on screen }
prompt: StringPtr; { --> Pascal string which is displayed on dialog }
buttonTitle: StringPtr; { --> Pascal string which replaces the "Open" or "Save" button }
origName: StringPtr; { --> Pascal string which is the original name in a PutFile }
dialogID: INTEGER; { --> Resource number of your dialog template }
SFFilterProc: ModalFilterProcPtr; { --> Pointer to your modal dialog filter proc }
showAllFiles: BOOLEAN; { --> TRUE if you want all files to be shown }
useMyTransList: BOOLEAN; { --> TRUE if you are using chosenTranslator and theChosenTranslator to input a list of translators to be used in creating the popup menu }
myFileFilter: FileFilterProcPtr; { --> Pointer to your SF Filter Proc }
Unused: LONGINT; { Reserved for future use, must be zero }
END;
{ This parameter block is used to find a translator to read a file.}
{ }
MatchTranslatorPtr = ^MatchTranslatorBlock;
MatchTranslatorBlock = RECORD
{ The following fields must be the same in this structure and in XTNDParamBlock }
allowFlags: LONGINT; { --> Flags which indicate Translators to be used }
numStandard: LONGINT; { --> How many "standard" file types }
standard: TransDescrPtr; { --> Native file format information }
ioResult: OSErr; { <-- IO Result from XTND library }
chosenTranslator: INTEGER; { <-> On input, number of translators supplied in the_Chosen_Translator; on output, chosen Translator number }
theChosenTranslator: TransDescrPtr;{ <-> On input, Pointer to list of translators to build popup menu from (UseMyTransList must be true if you supply this list); on output, pointer to the Chosen Translator }
{ End of common fields }
fileName: StringPtr; { --> File name }
vRefNum: INTEGER; { --> Volume Reference Number of file }
ioDirID: LongInt; { --> Directory id of file }
initFlag: Boolean; { --> TRUE if the list of translators should be rebuilt }
useTransList: Boolean; { --> TRUE if you are using chosenTranslator and theChosenTranslator }
{ to input a list of translators }
oneTrans: TransDescrPtr; { --> If this is supplied, it will be tried instead of}
{ searching all available translators }
unused: ARRAY[0..3] OF LONGINT; { Reserved for future use, must be zero }
END;
SelectParamPtr = ^SelectParamBlock;
SelectParamBlock = RECORD
translatorVersion: INTEGER; { To select by translator type }
translatorType: ResType; { and version }
includeFlags: LONGINT; { Include any of these translator types }
excludeFlags: LONGINT; { Exclude all of these translator types }
includeTrans: INTEGER; { Include translators with any of these flags set }
excludeTrans: INTEGER; { Excluded translator with any of these flags set }
transName: StringPtr; { Include only translators with this name }
PBVersion: LONGINT; { ••• MUST be ONE (1) for this version ••• }
MenuSortFlag: Boolean; { TRUE if you want the list sorted and duplicates removed as when the XTND System creates a menu in ClarisGetFile or ClarisPutFile for you }
unused1: Boolean; { Reserved for future use, must be zero }
unused2: INTEGER; { Reserved for future use, must be zero }
unused: ARRAY[0..3] OF LONGINT;
END;
{ Routines available in XTNDLibrary }
FUNCTION XTNDInitTranslators (transVersion: INTEGER; xtndSystemName, clarisFolderName: Str255): OSErr;
FUNCTION XTNDGetFile (paramPtr: SFParamPtr): BOOLEAN;
FUNCTION XTNDPutFile (paramPtr: SFParamPtr): BOOLEAN;
FUNCTION XTNDLoadTranslator (theTranslator: TransDescrPtr; VAR transResource: TransProcPtr): OSErr;
FUNCTION XTNDReleaseTranslator (theTranslator: TransDescrPtr): OSErr;
PROCEDURE XTNDCloseTranslators;
FUNCTION XTNDRebuildTransList: OSErr;
FUNCTION XTNDSelectTranslators (selectPtr: SelectParamPtr; transHandle: TransDescrHandle): OSErr;
FUNCTION XTNDMatchFile (matchPtr: MatchTranslatorPtr): BOOLEAN;